//
//  HttpManager.h
//  Booking
//
//  Created by Duntech on 2018/4/18.
//  Copyright © 2018年 Duntech. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HYBaseNetworkModel.h"

/** 网络请求成功的Block */
typedef void(^requestSuccess)(HYBaseNetworkModel *baseNetModel);
/** 网络请求失败的Block */
typedef void(^requestFailure)(NSError *error);

@interface HttpManager : NSObject

/** 单例HTTPManager */
+ (instancetype )shareHTTPManager;

@property (nonatomic,strong) AFNetworkReachabilityManager *reachabilityManager;

/*!
 @method
 @brief                 封装get请求
 @param url             get请求的URL
 @param para            get请求的参数
 @param view     展示HUD的View  如果为nil就不显示HUD
 @param successBlock    请求成功回调
 */
- (void)getDataFromUrl:(NSString *)url
         withParameter:(NSDictionary *)para
           showHUDView:(UIView *)view
               success:(requestSuccess)successBlock;

/*!
 @method
 @brief        封装POST请求
 @param url    请求的URL
 @param para   请求的参数
 @param view     展示HUD的View  如果为nil就不显示HUD
 @param successBlock    请求成功回调
 */
- (void)postDataFromUrl:(NSString *)url
          withParameter:(NSDictionary *)para
            showHUDView:(UIView *)view
                success:(requestSuccess)successBlock;

/*!
 @method
 @brief        封装Delete请求
 @param url    请求的URL
 @param para   请求的参数
 @param view     展示HUD的View  如果为nil就不显示HUD
 @param successBlock    请求成功回调
 */
- (void)deleteDataFromUrl:(NSString *)url
          withParameter:(NSDictionary *)para
            showHUDView:(UIView *)view
                success:(requestSuccess)successBlock;

/*!
 @method
 @brief        封装Put请求
 @param url    请求的URL
 @param para   请求的参数
 @param view     展示HUD的View  如果为nil就不显示HUD
 @param successBlock    请求成功回调
 */
- (void)putDataFromUrl:(NSString *)url
            withParameter:(NSDictionary *)para
              showHUDView:(UIView *)view
                  success:(requestSuccess)successBlock;

@end
